%%% Copyright 2010 Google Inc.
%%%
%%% Licensed under the Apache License, Version 2.0 (the "License");
%%% you may not use this file except in compliance with the License.
%%% You may obtain a copy of the License at
%%%
%%%     http://www.apache.org/licenses/LICENSE-2.0
%%%
%%% Unless required by applicable law or agreed to in writing, software
%%% distributed under the License is distributed on an "AS IS" BASIS,
%%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
%%% See the License for the specific language governing permissions and
%%% limitations under the License.

%%% Author <jacoby@google.com> Jacoby Thwaites [http://sites/madcloud]
%%%
%%% Header file for the web_srv module.

%%% ---------------------------------------------------------------------------
%%% HTTP request constants.
%%% ---------------------------------------------------------------------------

%% Standard headers.
-define(HTTP_XML_HEADER, "Content-Type: " ?CONTENT_TYPE_XML).
-define(HTTP_HTML_HEADER, "Content-Type: " ?CONTENT_TYPE_HTML).

%% JSON header is most reliably text/plain, not application/json at this time.
-define(HTTP_JSON_HEADER, "Content-Type: " ?CONTENT_TYPE_PLAIN).
-define(HTTP_LINE_BREAK, "\r\n").
-define(HTTP_END_HEADER, ?HTTP_LINE_BREAK ?HTTP_LINE_BREAK).

%% XML declaration specifies 2 byte UTF encoding.
-define(XML_DECLARATION,  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
                          ?HTTP_LINE_BREAK).

%% Client side XSL declaration with href parameter locating the XSLT.
-define(XSL_DECLARATION(REF), "<?xml-stylesheet href=\""
                              ++ REF ++
                              "\" type=\"text/xsl\"?>"
                              ?HTTP_LINE_BREAK).
%% HTTPD env keys
-define(ENV_HTTP_REFERER, http_referer).
-define(ENV_CONTENT_TYPE, http_content_type).

%% Content type values
-define(CONTENT_TYPE_PLAIN, "text/plain").
-define(CONTENT_TYPE_XML, "text/xml").
-define(CONTENT_TYPE_HTML, "text/html").
-define(CONTENT_TYPE_MULTIPART, "multipart/form-data").

%% HTTP request query string/post parameter keys (must be string)
-define(QUERY_CALLBACK, "callback").
-define(QUERY_COOKIE, "cookie").
-define(QUERY_FILE, "file").
-define(QUERY_FOLDER, "folder").
-define(QUERY_INPUT_SET, "inputSet").
-define(QUERY_IS_COMPOSITE, "isComposite").
-define(QUERY_JSON, "json").
-define(QUERY_MASK_SET, "maskSet").
-define(QUERY_NAME, "name").
-define(QUERY_OP, "op").
-define(QUERY_OUTPUT_SETS, "outputSets").
-define(QUERY_PARENT, "parent").
-define(QUERY_PATH, "path").
-define(QUERY_ROOT, "root").
-define(QUERY_TYPE, "type").
-define(QUERY_VSN, "vsn").
-define(QUERY_XSL, "xsl").

%% HTTP request query string/post parameter values (must be strings)
-define(QUERY_VALUE_TRUE, "true").
-define(QUERY_VALUE_FALSE, "false").

%% Support for multipart/form-data encoding (used in file upload)
-define(CONTENT_DISPOSITION_HEADER, "Content-Disposition").
-define(FORM_DATA_BOUNDARY_PREFIX, "--").
-define(FORM_DATA_PART, "form-data").
-define(FORM_DATA_NAME, "name").
